import java.util.HashSet;
//宝石与石头
public class test127 {
    public int numJewelsInStones(String jewels,String stones){
        HashSet<Character> set = new HashSet<>();
        char[] array1 = jewels.toCharArray();
        char[] array2 = stones.toCharArray();
        int count = 0;
        for(int i=0;i<array1.length;i++){
            if(!set.contains(array1[i])){
                set.add(array1[i]);
            }
        }
        for (int i = 0; i < array2.length; i++) {
            if (set.contains(array2[i])){
                count++;
            }
        }
        return count;
    }
}
